package Managers;

import Entities.Medium;
import Entities.Category;
import Tools.DatabaseException;
import org.w3c.dom.Document;
import org.xmldb.api.modules.XMLResource;

/**
 * Created by Oliver Mrazik on 10. 5. 2014.
 * author: Oliver Mrazik
 * version: 2014-05-10
 */
public interface LibraryManager {

    /**
     * Insert medium into category.
     * @param medium inserted medium
     * @param category category to which will be inserted
     * @throws Tools.DatabaseException when error occurs while inserting
     */
    public void insertMediumIntoCategory(Medium medium, Category category) throws DatabaseException;

    /**
     * Remove medium from category.
     * @param medium deleted medium
     * @param category category from which will be deleted
     * @throws Tools.DatabaseException when error occurs while removing
     */
    public void removeMediumFromCategory(Medium medium, Category category) throws DatabaseException;

    /**
     * Find category for medium.
     * @param medium medium for which we search category
     * @return found category
     * @throws Tools.DatabaseException when error occurs while returning category
     */
    public Category getCategoryByMedium(Medium medium) throws DatabaseException;

    /**
     * Get document with mediums as XMLDocument.
     * @param id category for which document will be created
     * @return XMLDocument
     * @throws Tools.DatabaseException when error occurs while creating document for category
     */
    public Document getCategoryWithMediumsAsXMLDocument(String id) throws DatabaseException;

    /**
     * Get whole database as one XMLDocument.
     * @param isAll choose whether return will be for main page or category list.
     * @return HTML representation of whole database (as table)
     * @throws Tools.DatabaseException when error occurs while transforming document into string
     */
    public String getDatabaseContentAsXMLDocument(Boolean isAll) throws DatabaseException;

    /**
     * Return document containing all mediums.
     * @return HTML representation of all mediums
     * @throws Tools.DatabaseException when error occurs while transforming document into string
     */
    public String getAllMediumsAsXMLDocument() throws DatabaseException;

    /**
     * Return medium entity as XMLDocument.
     * @param id medium to be transformed
     * @return XMLDocument
     * @throws Tools.DatabaseException when error occurs while creating document for medium
     */
    public Document getMediumAsXMLDocument(String id) throws DatabaseException;

    /**
     * Return medium entity as XMLDocument.
     * @param id medium to be transformed
     * @return HTML representation of medium
     * @throws Tools.DatabaseException when error occurs while transforming document into string
     */
    public String getMediumAsString(String id) throws DatabaseException;

    //public void importFromODF();
}
